package Task3;
/**
 * 上网套餐类
 * 特征：上网流量、每月资费
 * 行为：显示所有套餐信息
 */
public class OnlinePackage extends AbstractPackage implements OnlineService{

    private int netFlow;    // 上网流量

    public OnlinePackage() {
    }

    public OnlinePackage(int netFlow, int monthlyRate) {
        super(monthlyRate);
        this.netFlow = netFlow;
    }

    public int getNetFlow() {
        return netFlow;
    }

    public void setNetFlow(int netFlow) {
        if(netFlow>=0) {
            this.netFlow = netFlow;
        } else {
            System.out.println("上网流量不合理哦！");
        }
    }

    @Override
    public void onlineService(int netFlow, PhoneCard phoneCard) {
        phoneCard.show();
        setNetFlow(netFlow);
    }

    @Override
    public void show() {
        System.out.println("OnlinePackage上网套餐类");
        System.out.println("上网流量：" + getNetFlow());
        //System.out.println("每月资费：" + getMonthlyRate());
    }
}
